const {BundleAnalyzerPlugin} = require('webpack-bundle-analyzer');
const {merge} = require('webpack-merge');
// const cdnConfig = require('./webpack.prod.cdn');
const argv = process.argv.splice(2);
// 打包体积分析插件
const plugs = argv.includes('--analyze')
    ? [
        new BundleAnalyzerPlugin(
            {
                analyzerMode: 'static',
                // analyzerHost: '0.0.0.0',
                analyzerPort: 8888,
                generateStatsFile: true, //是否生成stats.json文件
                // statsFilename:"stats.json",
                // reportFilename:'report.html',
                openAnalyzer: true //是否打开浏览器
            }
        )
    ]
    : [];
const prodConfig = require('./webpack.prod');
module.exports = merge(prodConfig, {
    plugins: [
        ...plugs
    ]
});